import Vue from 'vue'

const apiUrl = 'api/'

export default {
  getByPage (pageNo, pageSize = 10) {
    return Vue.http.get(apiUrl + 'engineer/page', {params: {pageNo, pageSize}})
  },
  getById (id) {
    return Vue.http.get(apiUrl + 'engineer/' + id)
  },
  save (engineer) {
    if (engineer.pkid) {
      return Vue.http.put(apiUrl + 'engineer', engineer)
    } else {
      return Vue.http.post(apiUrl + 'engineer', engineer)
    }
  },
  file (file) {
    return Vue.http.post(apiUrl + 'engineer/file', file, {emulateJSON: true})
  }
}
